package com.hoshiicloud.as2c.minipro.feign;

import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import com.hoshiicloud.common.rpc.Response;
import com.hoshiicloud.as2c.minipro.feign.hystrix.HystrixCustomerFeignFallback;
import com.hoshiicloud.as2c.minipro.param.*;
import com.hoshiicloud.as2c.minipro.param.*;
import com.hoshiicloud.as2c.minipro.vo.CartDetailVO;
import com.hoshiicloud.as2c.minipro.vo.CartVO;
import com.hoshiicloud.as2c.minipro.vo.GoodsBrowseRecordDetailVO;
import com.hoshiicloud.as2c.minipro.vo.GoodsBrowseRecordVO;
import org.springframework.cloud.openfeign.FeignClient;
import org.springframework.web.bind.annotation.*;

import java.util.List;

/**
 * @author yangcheng
 * @version 1.0
 * @title: CustomerFeignService
 * @description: 客户操作微服务FeignClient
 * @date 2019/6/6 18:16
 * @mail maiboyc@163.com
 */
@FeignClient(name = "hoshiicloud-sale-order", fallback = HystrixCustomerFeignFallback.class)
public interface CustomerFeignService {

    /**
     * 新增购物车购物信息
     * @param param 加入购物车参数
     * @return  Response
     */
    @RequestMapping(value = "/saleorder/cart/add", method = RequestMethod.POST)
    Response add(@RequestBody CartAddParam param);

    /**
     * 修改购物车购物信息
     * @param param 更新购物车参数
     * @return Response
     */
    @RequestMapping(value = "/saleorder/cart/update", method = RequestMethod.POST)
    Response update(@RequestBody CartUpdateParam param);

    /**
     * 更新购物车商品失效状态
     * @param userId 用户ID
     * @return Response
     */
    @RequestMapping(value = "/saleorder/cart/checkCart",method = RequestMethod.POST)
    Response updateCartStatus(@RequestParam("userId") String userId);

    /**
     * 删除购物车购物信息记录表
     * @param id 购物车ID
     * @return Response
     */
    @RequestMapping(value = "/saleorder/cart/delete", method = RequestMethod.POST)
    Response delete(@RequestParam("id") String id);

    /**
     * 根据用户ID和店铺ID批量删除购物车购物信息
     * @param userId    用户ID
     * @param storeId   店铺ID
     * @return Response
     */
    @RequestMapping(value = "/saleorder/cart/deleteByUserIdAndStoreId", method = RequestMethod.DELETE)
    Response deleteByUserIdAndStoreId(@RequestParam("userId") Long userId, @RequestParam("storeId") Long storeId);

    /**
     * 批量删除购物车购物信息记录表
     * @param ids 购物车IDS
     * @return Response
     */
    @RequestMapping(value = "/saleorder/cart/deleteByIds", method = RequestMethod.POST)
    Response deleteByIds(@RequestParam("ids") List<Long> ids);

    /**
     * 获取购物车购物信息详情
     * @param id 主键ID
     * @return Response<CartDetailVO>
     */
    @RequestMapping(value = "/saleorder/cart/getDetail", method = RequestMethod.GET)
    Response<CartDetailVO> getDetail(@RequestParam("id") String id);

    /**
     * 获取购物车购物信息列表
     * @param param 查询参数
     * @return Response<List<CartVO>>
     */
    @RequestMapping(value = "/saleorder/cart/getList", method = RequestMethod.POST)
    Response<List<CartVO>> getList(@RequestBody CartQueryParam param);

    /**
     * 分页获取购物车购物信息列表
     * @param param 分页参数
     * @return Response<IPage<CartVO>>
     */
    @RequestMapping(value = "/saleorder/cart/getPage", method = RequestMethod.POST)
    Response<Page<CartVO>> getPage(@RequestBody CartQueryParam param);

    /**
     * 新增商品浏览记录
     * @param param 新增参数
     * @return Response
     */
    @RequestMapping(value = "/saleorder/goods-browse-record/add", method = RequestMethod.POST)
    Response add(@RequestBody GoodsBrowseRecordAddParam param);

    /**
     * 获取商品浏览记录列表
     * @param param 查询参数
     * @return Response<List<GoodsBrowseRecordVO>>
     */
    @RequestMapping(value = "/saleorder/goods-browse-record/getList", method = RequestMethod.GET)
    Response<List<GoodsBrowseRecordVO>> getList(@RequestBody GoodsBrowseRecordQueryParam param);

    /**
     * 获取商品浏览记录详情
     * @param id 浏览记录ID
     * @return Response<GoodsBrowseRecordDetailVO>
     */
    @RequestMapping(value = "/saleorder/goods-browse-record/getDetail", method = RequestMethod.GET)
    Response<GoodsBrowseRecordDetailVO> getGoodsBrowseDetail(@RequestParam("id") String id);

}
